package thread;

public class Demo extends Thread{
    @Override
    public void run() {
        print();
    }
    public Demo(String name){
        super(name);
    }
    public void print()  {
        for (int i = 0; i <100 ; i++) {
            try {
                this.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(getName()+" : "+i);
        }
    }

    public static void main(String[] args) {
        Demo a=new Demo("阿旺");
        Demo b=new Demo("阿财");
        a.start();
        b.start();
    }


}
